$(function () {
  // 初始化分页器
  function initAppCustomerPagination () {
    new Swiper('.app-customer-candidates .swiper', {
      lazyLoadingInPrevNextAmount: 1,   //加载下一个slide
      slidesPerView: 3,
      spaceBetween: 42,
      loop: false,  // 自动轮播
      autoplay: {
        delay: 1000,          // 每5秒切换一次
        disableOnInteraction: false, // 用户操作后仍继续自动滚动
        pauseOnMouseEnter: true,     // 鼠标移入时暂停滚动 ✅
      },
      breakpoints: {
        0: { // 当屏幕宽度 >=0 时，覆盖配置（相当于小屏）
          slidesPerView: 1,
          spaceBetween: 0,
          slidesPerGroup: 1,


        },
        768: { // 当屏幕宽度 >=768px 时，覆盖配置
          slidesPerView: 3,
          spaceBetween: 42,
          slidesPerGroup: 3,
        }
      },
      pagination: {
        el: '.swiper-pagination',
        clickable: true,
      },
    })

    $('.app-customer-candidates .swiper-slide').each(function () {
      var _$this = $(this)
      _$this.find('.customer-avatar').text(
        GetFirstCharacter(_$this.find('.customer-name').text().trim())
      )
      _$this.find('.customer-avatar').css('background-color', GenerateAvatar())
    })
  }
  initAppCustomerPagination()
})